home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / Anwender / Grafik / PPT / rexx / components.prx < prev    next >
Text File  |  1998-06-29  |  2KB  |  80 lines

  1. /*
  2.     This rexx script will extract the different color components
  3.     from an image and puts them into three different frames.
  4.  
  5.     $Id: Components.prx 1.2 1998/06/29 20:51:43 jj Exp jj $
  6. */
  7.  
  8. /*-------------------------------------------------------------------*/
  9. /*  I suggest you use this header as-is and add your own code below  */
  10.  
  11. OPTIONS RESULTS
  12. SIGNAL ON ERROR
  13. IF ADDRESS() = REXX THEN DO
  14.     startedfromcli = 1
  15.     ADDRESS PPT
  16. END
  17. ELSE DO
  18.     startedfromcli = 0
  19.     ADDRESS PPT
  20. END
  21. RESULT = 'no result'
  22.  
  23. /*-------------------------------------------------------------------*/
  24. /* Modify only below this place */
  25.  
  26. PARSE ARG framer
  27.  
  28. IF DATATYPE(framer) ~= NUM THEN DO
  29.     RC  = 10
  30.     RC2 = "No frame selected"
  31.     SIGNAL ERROR
  32. END
  33.  
  34. /*
  35.     Determine the name to be used by extracting the necessary
  36.     info from the frame.
  37. */
  38. FRAMEINFO framer STEM inf
  39.  
  40. newname = inf.name
  41. RENAMEFRAME framer newname || ".RED"
  42.  
  43.  
  44. /*
  45.     Duplicate the frame twice.
  46. */
  47.  
  48. COPYFRAME framer
  49. frameg = RESULT
  50. RENAMEFRAME frameg newname || ".GREEN"
  51.  
  52. COPYFRAME framer
  53. frameb = RESULT
  54. RENAMEFRAME frameb newname || ".BLUE"
  55.  
  56. /*
  57.     Process.
  58. */
  59.  
  60. PROCESS framer 'Extract RED'
  61. PROCESS frameg 'Extract GREEN'
  62. PROCESS frameb 'Extract BLUE'
  63.  
  64. EXIT
  65.  
  66. /*-------------------------------------------------------------------*/
  67. /* Again, keep this part intact. This is the error handler. */
  68.  
  69. ERROR :
  70. returncode = RC
  71. IF startedfromcli = 1 THEN DO
  72.     SAY 'ERROR ' returncode ' on line ' SIGL ': ' RC2
  73.     PPT_TO_BACK
  74. END
  75. ELSE
  76.     SHOWERROR '"'RC2'"' SIGL
  77. EXIT returncode
  78.  
  79.  
  80.